﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>热表转工排产无限制名单</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
    <style type="text/css">
        .l-btn2
        {
            border: #d2d2d2 1px solid;
            font-family: Tahoma, Helvetica;
            font-size: 10px;
            cursor: pointer;
            font-weight: 500;
            text-decoration: none;
            height: 26px;
            color: #fff;
            background: #02bfbf;
        }
        .l-btn2:hover
        {
            color: #fff;
            background: #05d2d2;
        }
        .btnNews
        {
            height: 20px;
            width: 50px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 9px;
            margin: 2px 2px;
            cursor: pointer;
            color: Black;
            border-radius: 1px;
            box-shadow: 0px 1px 0px #3d6b93;
            line-height: 10px;
            text-align: center;
            text-decoration: none;
            transition: background-color 0.15s ease-in-out;
        }
    </style>
</head>
<body>
    <div id="mainSec">
        <div class="panelSection">
            <div class="easyui-panel " title="查询区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <form id="queryForm" action="">
                <div style="margin: 3px 0px 3px 3px">
                    <div style="float: left;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            批次名：</div>
                        <input id="txtContainerName_qf" name="containerName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 20px">
                        <a id="btnSearch" href='#' class="easyui-linkbutton" style="margin-top: 16px; width: 80px">
                            查询</a> <a id="btnReset" href='#' class="easyui-linkbutton" style="margin-top: 16px;
                                margin-left: 5px;">重置</a>
                    </div>
                    <div style="clear: both">
                    </div>
                </div>
                </form>
                <form id="queryForm1" action="">
                <div style="margin: 3px 0px 3px 3px">
                    <div style="float: left;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            添加日期：</div>
                        <input id="txtStartDate_qf" name="startDate" class="easyui-datebox" type="text" style="width: 120px;
                            height: 22px" data-options='editable:false' />
                        -
                        <input id="txtEndDate_qf" name="endDate" class="easyui-datebox" type="text" style="width: 120px;
                            height: 22px;" data-options='editable:false' />
                    </div>
                    <div style="float: left; margin-left: 20px">
                        <a id="btnSearch1" href='#' class="easyui-linkbutton" style="margin-top: 16px; width: 80px">
                            查询</a> <a id="btnReset1" href='#' class="easyui-linkbutton" style="margin-top: 16px;
                                margin-left: 5px;">重置</a> <a id="btnExport" href='#' class="easyui-linkbutton" style="margin-top: 16px;
                                    width: 80px; margin-left: 10px;">导出</a>
                    </div>
                    <div style="clear: both">
                    </div>
                </div>
                </form>
            </div>
        </div>
        <div id="tt" class="easyui-tabs" style="width: 100%; height: 90%">
            <div title="待添加" style="padding: 3px; display: none;">
                <div style="margin: 3px 0px 3px 3px; width: 99%; height: 70%;">
                    <table id="gdApsInfo" class="easyui-datagrid" style="width: 100%; height: 100%;"
                        data-options="fitColumns:true,rownumbers:true">
                    </table>
                    <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['list','first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: true,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
                    </div>
                </div>
                <div class="panelSection">
                    <div class="easyui-panel " title="查询区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                        <div style="float: left;">
                            <a id="btnUnlimited" href='#' class="easyui-linkbutton" style="width: 150px">添加到无限制</a>
                        </div>
                    </div>
                </div>
            </div>
            <div title="已添加" style="padding: 3px; display: none;">
                <div style="margin: 3px 0px 3px 3px; width: 99%; height: 70%;">
                    <table id="gdUnLimitInfo" class="easyui-datagrid" style="width: 100%; height: 100%;"
                        data-options="fitColumns:true,rownumbers:true">
                    </table>
                    <div id="pp1" style="float: right" class="easyui-pagination" data-options="   
                 layout:['list','first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: true,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo1'
                    }]  
                ">
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/webuploader/webuploader.js"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2024-06-25
    描述：热表转工排产无限制js
    */
    var page = {
        rootPath: getRootPath(), //网站根路径
        url: getRootPath() + "/Ashx/ApsHandler/ApsPlanConfirmHandler.ashx",
        commonUrl: getRootPath() + "/Ashx/CommonHandler.ashx",
        //初始化页面
        init: function () {
            apsPage.init();
            unLimitPage.init();
            page.bind();
        },
        //页面事件绑定
        bind: function () {
            $("#queryForm1").hide(); //页面加载默认隐藏第二页的查询条件
            //tab页选择事件
            $('#tt').tabs({
                border: false,
                onSelect: function (title, index) {
                    switch (index) {
                        case 0:
                            $("#queryForm1").hide();
                            $("#queryForm").show();
                            break;
                        case 1:
                            $("#queryForm").hide();
                            $("#queryForm1").show();
                            break;
                        case 2:
                            $("#divIsInstore").show();
                            break;
                        default: break;
                    }
                }
            });
        },
        //禁用页面按钮
        disableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('disable');
            });
        },
        //启用页面按钮
        enableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('enable');
            });
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    $("body").find(".easyui-linkbutton").each(function () {
                        $(this).linkbutton('enable');
                    });
                }
            });
        }
    };
    /*----------带添加无限制的逻辑处理------------*/
    var apsPage = {
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        //初始化页面
        init: function () {
            apsPage.bind();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        //页面事件绑定
        bind: function () {
            //列表加载
            $("#gdApsInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: apsPage.pageTotal,
                        pageSize: apsPage.pageSize,
                        pageNumber: apsPage.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
                 { field: 'CONTAINERNAME', title: '批次名', width: 150 },
                 { field: 'WORKFLOWINFO', title: '工艺及版本', width: 150 },
                 { field: 'WORKFLOWSTEPNAME', title: '工序', width: 150 },
                 { field: 'STARTTIME', title: '排产开始时间', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'ENDTIME', title: '排产结束时间', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 }
                ]]
            });

            //查询按钮
            $('#btnSearch').on("click", function () {
                apsPage.clearPage(false, true);
                apsPage.pageNumber = 1;
                apsPage.searchData();
            });
            //添加按钮
            $('#btnUnlimited').on("click", function () {
                apsPage.addUnlimited();
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    //customizedEasyuiPagination('pp'); //定制化分页
                    apsPage.pageSize = pageSize; apsPage.pageNumber = pageNumber === 0 ? 1 : pageNumber;
                    apsPage.searchData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = Number($(this).parents('tr').find('.pagination-num').val());
                apsPage.pageSize = $(".pagination-page-list").val();
                apsPage.pageNumber = pageNumber;
                apsPage.searchData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                apsPage.clearPage(true, true);
                apsPage.pageNumber = 1; apsPage.pageTotal = 0
                $('#pp').pagination('refresh', {
                    total: apsPage.pageTotal,
                    pageSize: apsPage.pageSize,
                    pageNumber: apsPage.pageNumber
                });
            });
        },
        //查询
        searchData: function () {
            var params = {
                action: "GetRBApsShipDatas",
                pageSize: apsPage.pageSize,
                pageIndex: apsPage.pageNumber
            };
            var queryFormData = $("#queryForm").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            page.post(page.url, params, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                apsPage.pageTotal = res.RowCount;
                $("#gdApsInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //添加到无限制名单
        addUnlimited: function () {
            var selectRow = $("#gdApsInfo").datagrid("getChecked");
            if (selectRow.length === 0) {
                displayMessage("请选择数据", false);
                return false;
            }
            var params = {
                action: "SaveApsShipUnlimitedDatas",
                params: JSON.stringify(selectRow)
            };
            page.post(page.url, params, true, function (res) {
                if (res.Result) {
                    apsPage.searchData();
                }
                displayMessage(res.Message, res.Result);
            });
        },
        //清除页面（查询区域，列表区域）
        clearPage: function (query, list) {
            if (query) {
                $("#txtContainerName_qf").textbox("clear");
            }
            if (list) {
                clearEasyuiDataGrid("gdApsInfo"); //清空列表
            }
        }
    };
    /*----------已添加无限制的逻辑处理------------*/
    var unLimitPage = {
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        //初始化页面
        init: function () {
            unLimitPage.bind();
            customizedEasyuiPagination('pp1'); //定制化分页
        },
        //页面事件绑定
        bind: function () {
            //列表加载
            $("#gdUnLimitInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp1').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: unLimitPage.pageTotal,
                        pageSize: unLimitPage.pageSize,
                        pageNumber: unLimitPage.pageNumber
                    });
                    customizedEasyuiPagination('pp1'); //定制化分页
                },
                columns: [[
                 { field: 'CONTAINERNAME', title: '批次名', width: 150 },
                 { field: 'WORKFLOWINFO', title: '工艺及版本', width: 150 },
                 { field: 'WORKFLOWSTEPNAME', title: '工序', width: 150 },
                 { field: 'STARTTIME', title: '排产开始时间', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'ENDTIME', title: '排产结束时间', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'FULLNAME', title: '添加人', width: 100 },
                 { field: 'CREATETIME', title: '添加时间', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD');
                     }
                 }
                 },
                 { field: 'REMARK', title: '备注', width: 150 }
                ]]
            });
            //查询按钮
            $('#btnSearch1').on("click", function () {
                unLimitPage.clearPage(false, true);
                unLimitPage.pageNumber = 1;
                unLimitPage.searchData();
            });
            //导出按钮
            $('#btnExport').on("click", function () {
                unLimitPage.export();
            });
            //分页事件
            $('#pp1').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    //customizedEasyuiPagination('pp'); //定制化分页
                    unLimitPage.pageSize = pageSize; unLimitPage.pageNumber = pageNumber === 0 ? 1 : pageNumber;
                    unLimitPage.searchData();
                }
            });
            //绑定分页go按钮
            $('#pageGo1').on("click", function () {
                var pageNumber = Number($(this).parents('tr').find('.pagination-num').val());
                unLimitPage.pageSize = $(".pagination-page-list").val();
                unLimitPage.pageNumber = pageNumber;
                unLimitPage.searchData();
            });
            //清除按钮
            $('#btnReset1').on("click", function () {
                unLimitPage.clearPage(true, true);
                unLimitPage.pageNumber = 1; unLimitPage.pageTotal = 0
                $('#pp1').pagination('refresh', {
                    total: unLimitPage.pageTotal,
                    pageSize: unLimitPage.pageSize,
                    pageNumber: unLimitPage.pageNumber
                });
            });
        },
        //查询
        searchData: function () {
            var params = {
                action: "GetRBUnLimitApsDatas",
                pageSize: unLimitPage.pageSize,
                pageIndex: unLimitPage.pageNumber
            };
            var queryFormData = $("#queryForm1").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            page.post(page.url, params, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                unLimitPage.pageTotal = res.RowCount;
                $("#gdUnLimitInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //导出无限制名单
        export: function () {
            var params = {
                action: "ExportUnLimitToExcel"
            };
            var queryFormData = $("#queryForm1").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            FileDownLoad(page.url, params); //下载文件
        },
        //清除页面（查询区域，列表区域）
        clearPage: function (query, list) {
            if (query) {
                $("#txtStartDate_qf").datebox("clear");
                $("#txtEndDate_qf").datebox("clear");
            }
            if (list) {
                clearEasyuiDataGrid("gdUnLimitInfo"); //清空列表
            }
        }
    };

    $(function () {
        page.init();
    });
</script>
